﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
using System.ComponentModel;
namespace CoreData
{
    /// <summary>
    /// Định nghĩa kỳ hạn đóng học phí theo khóa học
    /// </summary>
    public class Class_FeeTime
    {
        [Description("ID")]
            public long ID{get;set;}
        
            public long ClassID{get;set;}
         [Description("Tên")]
            public string Times{get;set;}
         [Description("StartDate1")]
            public DateTime StartDate1{get;set;}
         [Description("EndDate1")]
            public DateTime EndDate1{get;set;}
         [Description("StartDate2")]
            public DateTime StartDate2{get;set;}
         [Description("EndDate2")]
            public DateTime EndDate2{get;set;}
         [Description("StartDate3")]
            public DateTime StartDate3{get;set;}
         [Description("EndDate3")]
            public DateTime EndDate3{get;set;}
         [Description("StartDate4")]
            public DateTime StartDate4{get;set;}
         [Description("EndDate4")]
            public DateTime EndDate4{get;set;}
         [Description("StartDate5")]
            public DateTime StartDate5{get;set;}
         [Description("EndDate5")]
            public DateTime EndDate5{get;set;}
         [Description("StartDate6")]
            public DateTime StartDate6{get;set;}
         [Description("EndDate6")]
            public DateTime EndDate6{get;set;}
         [Description("Số tiền lần 1")]
         public long Money1 { get; set; }
         [Description("Số tiền lần 2")]
         public long Money2 { get; set; }
         [Description("Số tiền lần 3")]
         public long Money3 { get; set; }
         [Description("Số tiền lần 4")]
         public long Money4 { get; set; }
         [Description("Số tiền lần 5")]
         public long Money5 { get; set; }
         [Description("Số tiền lần 6")]
         public long Money6 { get; set; }
         [Description("Type")]
            public int Type{get;set;}
         
        public Class_FeeTime()
        {       
                            Times ="";   
        }
        
       static Class_FeeTime DynamicCast<T>(object row_data, object row_header) where T : Class_FeeTime
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           Class_FeeTime ret = new Class_FeeTime();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "ClassID":
                        ret.ClassID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "Times":
                        ret.Times = ConvertObject.ToString(dt[column]);
                       break;
                      case  "StartDate1":
                        ret.StartDate1 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "EndDate1":
                        ret.EndDate1 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "StartDate2":
                        ret.StartDate2 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "EndDate2":
                        ret.EndDate2 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "StartDate3":
                        ret.StartDate3 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "EndDate3":
                        ret.EndDate3 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "StartDate4":
                        ret.StartDate4 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "EndDate4":
                        ret.EndDate4 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "StartDate5":
                        ret.StartDate5 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "EndDate5":
                        ret.EndDate5 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "StartDate6":
                        ret.StartDate6 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "EndDate6":
                        ret.EndDate6 = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case "Money1":
                       ret.Money1 = ConvertObject.ToLong(dt[column]);
                       break;
                      case "Money2":
                       ret.Money2 = ConvertObject.ToLong(dt[column]);
                       break;
                      case "Money3":
                       ret.Money3 = ConvertObject.ToLong(dt[column]);
                       break;
                      case "Money4":
                       ret.Money4 = ConvertObject.ToLong(dt[column]);
                       break;
                      case "Money5":
                       ret.Money5 = ConvertObject.ToLong(dt[column]);
                       break;
                      case "Money6":
                       ret.Money6 = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "Type":
                        ret.Type = ConvertObject.ToInt(dt[column]);
                       break;
                
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
